package com.coderfans.datagithub.model;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by ${fanchunshuai} on 2016-11-15.
 *
 * @version: V1.0
 * @Desc: github用户网页模型
 * @Copyright (c) 2016 58到家-版权所有
 */
public class UserModel extends IModel{
    private long id;

    private String username;             //昵称
    private String fullname;             //用户名
    private String email;                //邮箱
    private String joindate;             //加入时间
    private Integer    followersNum;         //跟随者
    private Integer    starsnum;             //星级
    private Integer    followingsnum;         //正在跟随者数量
    private Integer    reponum;              //仓库数量
    private Integer    followersnum;         //跟随着数量

    private String userIntroduce;        //用户简介
    private String address;              //目前所在地
    private String personalSite;         //个人网站
    private String school;               //毕业学校

    private List<String>  hrefList;      //页面链接列表
    private List<String>  orgList;       //组织列表

    private String orgListStr;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Integer getStarsnum() {
        return starsnum;
    }

    public void setStarsnum(Integer starsnum) {
        this.starsnum = starsnum;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getJoindate() {
        return joindate;
    }

    public void setJoindate(String joindate) {
        this.joindate = joindate;
    }

    public Integer getFollowersNum() {
        return followersNum;
    }

    public void setFollowersNum(Integer followersNum) {
        this.followersNum = followersNum;
    }

    public Integer getFollowingsnum() {
        return followingsnum;
    }

    public void setFollowingsnum(Integer followingsnum) {
        this.followingsnum = followingsnum;
    }

    public Integer getReponum() {
        return reponum;
    }

    public void setReponum(Integer reponum) {
        this.reponum = reponum;
    }

    public Integer getFollowersnum() {
        return followersnum;
    }

    public void setFollowersnum(Integer followersnum) {
        this.followersnum = followersnum;
    }

    public String getUserIntroduce() {
        return userIntroduce;
    }

    public void setUserIntroduce(String userIntroduce) {
        this.userIntroduce = userIntroduce;
    }

    public String getPersonalSite() {
        return personalSite;
    }

    public void setPersonalSite(String personalSite) {
        this.personalSite = personalSite;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public List<String> getHrefList() {
        return hrefList;
    }

    public void setHrefList(List<String> hrefList) {
        this.hrefList = hrefList;
    }

    public List<String> getOrgList() {
        return orgList;
    }

    public void setOrgList(List<String> orgList) {
        this.orgList = orgList;
    }

    @Override
    public Map<String, String > getXpathMap() {
        Map<String,String> spiderModelMap =  new HashMap<>();
        spiderModelMap.put("hrefList","//a/@href");
        //获取姓名
        spiderModelMap.put("username","//h1[@class='vcard-names']/span[@class='vcard-username']/text()");
        //获取学校
        spiderModelMap.put("school","//ul[@class='vcard-details']/li[@class='vcard-detail']/div/text()");
        //获取地址
        spiderModelMap.put("address","//ul[@class='vcard-details']//li[@aria-label='Home location']/@title");
        //获取全名
        spiderModelMap.put("fullname","//h1[@class='vcard-names']/span[@class='vcard-fullname']/text()");
        //获取邮箱
        spiderModelMap.put("email","//ul[@class='vcard-details']/li[@aria-label='Email']/a/text()");
        //获取个人网站
        spiderModelMap.put("personalSite","//ul[@class='vcard-details']/li[@aria-label='Blog or website']/a/text()");
        //获取加入时间
        spiderModelMap.put("joindate","//ul[@class='vcard-details']/li[@aria-label='Member since']/local-time[@class='join-date']/text()");
        //获取repositorynum
        spiderModelMap.put("reponum","//nav[@class='underline-nav']/a[2]/span/text()");
        //获取starsnum
        spiderModelMap.put("starsnum","//nav[@class='underline-nav']/a[3]/span/text()");
        //获取followersnum
        spiderModelMap.put("followersnum","//nav[@class='underline-nav']/a[4]/span/text()");
        //获取followingsnum
        spiderModelMap.put("followingsnum","//nav[@class='underline-nav']/a[5]/span/text()");
        //获取所属组织
        spiderModelMap.put("orgList","//div[@class='border-top py-3 clearfix']//a/@href");

        return spiderModelMap;
    }

    public String getOrgListStr() {
        return orgListStr;
    }

    public void setOrgListStr(String orgListStr) {
        this.orgListStr = orgListStr;
    }

    @Override
    public String toString() {
        return "UserModel{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", fullname='" + fullname + '\'' +
                ", email='" + email + '\'' +
                ", joindate='" + joindate + '\'' +
                ", followersNum=" + followersNum +
                ", starsnum=" + starsnum +
                ", followingsnum=" + followingsnum +
                ", reponum=" + reponum +
                ", followersnum=" + followersnum +
                ", userIntroduce='" + userIntroduce + '\'' +
                ", address='" + address + '\'' +
                ", personalSite='" + personalSite + '\'' +
                ", school='" + school + '\'' +
                ", hrefList=" + hrefList +
                ", orgList=" + orgList +
                ", orgListStr='" + orgListStr + '\'' +
                '}';
    }
}
